
package com.gome.gop.common;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang.StringUtils;

/**
 *
 * @Title:
 * @Description:数据字典中的code类型
 * @Author:12944
 * @Since:2018年3月13日 下午2:51:51
 * @Copyright:Copyright (c) 2018 - 2100
 * @Company:gome
 * @Version:1.1.0
 */
public enum ChangeTypeEnum {

    UPDATED("updated")
    , DELETED("deleted")
    , INSERTED("inserted")
    , NO_CHANGE("noChange")
    ;

    public static List<String> getNameList() {
        ChangeTypeEnum[] documentTypes = ChangeTypeEnum.values();
        List<String> list = new ArrayList<String>();
        for (ChangeTypeEnum documentType : documentTypes) {
            list.add(documentType.toString().toUpperCase());
        }
        return list;
    }

    public static List<String> getValueList() {
        ChangeTypeEnum[] documentTypes = ChangeTypeEnum.values();
        List<String> list = new ArrayList<String>();
        for (ChangeTypeEnum documentType : documentTypes) {
            list.add(documentType.getValue().toString().toUpperCase());
        }
        return list;
    }

    private String value;

    private ChangeTypeEnum(String value) {
        this.value = value;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public static ChangeTypeEnum getEnumByvalue(String value) {
        for (ChangeTypeEnum userAccountEnum : ChangeTypeEnum.values()) {
            if (StringUtils.equals(value, userAccountEnum.getValue())) {
                return userAccountEnum;
            }
        }
        return null;
    }

}
